 package client.skills;

 import constants.ItemConstants;
 import tools.Randomizer;








 public class InnerAbillity
 {
/*  15 */   private static InnerAbillity instance = null;

   public static InnerAbillity getInstance() {
/*  18 */     if (instance == null) {
/*  19 */       instance = new InnerAbillity();
     }
/*  21 */     return instance;
   }





   public InnerSkillEntry renewSkill(int rank, int position) {
/*  29 */     int skillLevel, randomSkill = ItemConstants.getInnerSkillbyRank(rank)[(int)Math.floor(Math.random() * (ItemConstants.getInnerSkillbyRank(rank)).length)];
/*  30 */     Skill skill = SkillFactory.getSkill(randomSkill);
/*  31 */     if (skill == null) {
/*  32 */       return null;
     }

/*  35 */     int firstmin = skill.getMaxLevel() / 2;
/*  36 */     int firstmax = skill.getMaxLevel();
/*  37 */     int Othermax = skill.getMaxLevel() / 2;
/*  38 */     switch (skill.getMaxLevel()) {

       case 40:
/*  41 */         firstmin = (rank == 0) ? 1 : ((rank == 1) ? 11 : ((rank == 2) ? 21 : 31));

/*  43 */         firstmax = (rank == 0) ? 10 : ((rank == 1) ? 20 : ((rank == 2) ? 30 : 40));

/*  45 */         Othermax = (rank == 0) ? 10 : ((rank == 1) ? 10 : ((rank == 2) ? 20 : 30));
         break;

       case 30:
/*  49 */         firstmin = (rank == 0 || rank == 1) ? 1 : ((rank == 2) ? 11 : 21);

/*  51 */         firstmax = (rank == 0) ? 1 : ((rank == 1) ? 10 : ((rank == 2) ? 20 : 30));

/*  53 */         Othermax = (rank == 0 || rank == 1) ? 1 : ((rank == 2) ? 10 : 20);
         break;

       case 20:
/*  57 */         firstmin = (rank == 0 || rank == 1 || rank == 2) ? 1 : 11;

/*  59 */         firstmax = (rank == 0 || rank == 1) ? 1 : ((rank == 2) ? 10 : 20);

/*  61 */         Othermax = (rank == 0 || rank == 1 || rank == 2) ? 1 : 10;
         break;

       case 10:
/*  65 */         firstmin = 1;

/*  67 */         firstmax = (rank == 0 || rank == 1 || rank == 2) ? 1 : 10;

/*  69 */         Othermax = 1;
         break;
     }

/*  73 */     if (position == 1) {
/*  74 */       skillLevel = Randomizer.rand(firstmin, firstmax);
     } else {
/*  76 */       skillLevel = Randomizer.rand(1, Othermax);
     }

/*  79 */     if (skillLevel > skill.getMaxLevel()) {
/*  80 */       skillLevel = skill.getMaxLevel();
     }

/*  83 */     return new InnerSkillEntry(randomSkill, skillLevel, (byte)position, (byte)rank);
   }
   public InnerSkillEntry renewSkill(int rank, int position, boolean ultimateCirculatorPos) {
     int skillLevel;
/*  87 */     if (ultimateCirculatorPos) {
/*  88 */       int j, i = ItemConstants.getInnerSkillbyRank(3)[(int)Math.floor(Math.random() * (ItemConstants.getInnerSkillbyRank(rank)).length)];
/*  89 */       Skill skill1 = SkillFactory.getSkill(i);
/*  90 */       if (skill1 == null) {
/*  91 */         return null;
       }

/*  94 */       int k = Randomizer.nextInt(100);
/*  95 */       if (k < 38) {
/*  96 */         j = Randomizer.rand(skill1.getMaxLevel() / 2, skill1.getMaxLevel());
/*  97 */       } else if (k < 70) {
/*  98 */         j = Randomizer.rand(skill1.getMaxLevel() / 3, skill1.getMaxLevel() / 2);
       } else {
/* 100 */         j = Randomizer.rand(skill1.getMaxLevel() / 4, skill1.getMaxLevel() / 3);
       }
/* 102 */       if (j > skill1.getMaxLevel()) {
/* 103 */         j = skill1.getMaxLevel();
       }
/* 105 */       return new InnerSkillEntry(i, j, (byte)position, (byte)3);
     }
/* 107 */     int circulatorRate = 10;
/* 108 */     if (ultimateCirculatorPos) {
/* 109 */       circulatorRate = 20;
     }
/* 111 */     if (Randomizer.isSuccess(3 + circulatorRate)) {
/* 112 */       rank = 1;
/* 113 */     } else if (Randomizer.isSuccess(2 + circulatorRate / 5)) {
/* 114 */       rank = 2;
/* 115 */     } else if (Randomizer.isSuccess(1 + circulatorRate / 10)) {
/* 116 */       rank = 3;
     } else {
/* 118 */       rank = 0;
     }



/* 123 */     int randomSkill = ItemConstants.getInnerSkillbyRank(rank)[(int)Math.floor(Math.random() * (ItemConstants.getInnerSkillbyRank(rank)).length)];
/* 124 */     Skill skill = SkillFactory.getSkill(randomSkill);
/* 125 */     if (skill == null) {
/* 126 */       return null;
     }

/* 129 */     int random = Randomizer.nextInt(100);
/* 130 */     if (random < 3 + circulatorRate / 2) {
/* 131 */       skillLevel = Randomizer.rand(skill.getMaxLevel() / 2, skill.getMaxLevel());
/* 132 */     } else if (random < circulatorRate) {
/* 133 */       skillLevel = Randomizer.rand(skill.getMaxLevel() / 3, skill.getMaxLevel() / 2);
     } else {
/* 135 */       skillLevel = Randomizer.rand(skill.getMaxLevel() / 4, skill.getMaxLevel() / 3);
     }
/* 137 */     if (skillLevel > skill.getMaxLevel()) {
/* 138 */       skillLevel = skill.getMaxLevel();
     }
/* 140 */     return new InnerSkillEntry(randomSkill, skillLevel, (byte)position, (byte)rank);
   }







   public int getCirculatorRank(int itemId) {
/* 150 */     return itemId % 1000 / 100 + 1;
   }

   public boolean isSuccess(int rate) {
/* 154 */     return (rate > Randomizer.nextInt(100));
   }
 }


/* Location:              C:\PGX\Server.jar!\client\skills\InnerAbillity.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */